//
//  MyHeadView.swift
//  HoneyBee
//
//  Created by point on 2018/1/26.
//  Copyright © 2018年 point. All rights reserved.
//

import UIKit

protocol MyHeadViewDelegate : class {
    func clickHead()
    func clickName()
}


class MyHeadView: UIView , NibLoadable {
    weak var delegate : MyHeadViewDelegate?
    @IBOutlet weak var headImageView: UIImageView!
    @IBOutlet weak var nameTitle: UILabel!
    override func awakeFromNib() {
         super.awakeFromNib()
        self.backgroundColor = kColorC2
        nameTitle.text = "请设置名称"
        headImageView.image = UIImage.icon(from: kIcon_emoji, color: kColorC1, imageSize: CGSize(width: 80, height: 80))
        headImageView.layer.cornerRadius = 40;
        headImageView.clipsToBounds = true
        nameTitle.isUserInteractionEnabled = true
        let tapnameGesutre = UITapGestureRecognizer(target: self, action: #selector(nametipFunc(_:)))
        nameTitle.addGestureRecognizer(tapnameGesutre)
        
        headImageView.isUserInteractionEnabled = true
        let tapGesutre = UITapGestureRecognizer(target: self, action: #selector(tipFunc(_:)))
        headImageView.addGestureRecognizer(tapGesutre)
    }
    
    @objc func tipFunc(_ ges:UITapGestureRecognizer) {
        delegate?.clickHead()
    }
    
    @objc func nametipFunc(_ ges:UITapGestureRecognizer) {
        delegate?.clickName()
    }
}
